package com.jp.knowledge.adapter;

import android.content.Context;
import android.widget.ImageView;
import android.widget.TextView;

import com.bumptech.glide.Glide;
import com.jp.knowledge.R;
import com.jp.knowledge.model.OtherTopic;

import java.util.List;

import jp.wasabeef.glide.transformations.CropCircleTransformation;

/**
 * Created by jiayen on 16/10/26.
 *
 * 其他话题适配器
 */

public class TopicOtherAdapter extends  JPBaseAdpter<OtherTopic> {
    public TopicOtherAdapter(Context context, List infos) {
        super(context, infos);
    }

    @Override
    protected int getLayoutId(int position) {
        return R.layout.topic_other_item;
    }


    @Override
    protected void renderData(JPViewHolder holder, OtherTopic item, int position) {
        ImageView icon = holder.getView(R.id.icon);
        TextView itemName = holder.getView(R.id.item_name);
        TextView talkNum = holder.getView(R.id.talk_num);

        Glide.with(getContext()).load(item.getCompanyIcon()).bitmapTransform(new CropCircleTransformation(getContext()))
                .fitCenter().placeholder(R.mipmap.cgsays_logo)
                .override(40,40).into(icon);//new BlurTransformation(getContext(), 25),
        itemName.setText(item.getCompanyName());
        talkNum.setText(item.getCommentNum()+"条讨论");
    }
}
